{% extends "main/base.html" %}
{% load i18n %}
{% block title %}{% trans '批量添加设备' %}{% endblock %}
{% block content %}
<section class="panel">
    <header class="panel-heading">
        {% trans "批量添加设备" %}
        {% if form.errors %}
        <p>{% trans "提交的数据有误,请认真检查!" %}</p>
        {% endif %}
    </header>
    <div class="panel-body">
        <form method="post" action="{% url 'main:batch_add_order_items' select_order_id %}" class="form-horizontal">{% csrf_token %}
            {{ form.non_field_errors }}
            {% if request.user.is_authenticated %}
            <input type="hidden" name="created_by" id="id_created_by" value="{{ request.user.id }}">
            {% endif %}
            <div class="form-group col-md-12">
                <div class="col-sm-2">{% trans '请选择设备列表' %}</div>
                <div class="col-sm-10">
                    <select name="batch_equipment" class="selectpicker show-tick form-control" data-live-search="true" required id="id_batch_equipment">
                        <option value="" selected>---------</option>
                        {% for e in equipment_list %}
                        <option value="{{ e.pk }}">{{ e.title }} {{ e.get_options }}</option>
                        {% endfor %}
                    </select>
                    {{ form.batch_equipment.errors }}
                </div>
            </div>
            <div class="form-group col-md-12" align="right">
                <a href="{% url 'main:order_detail' select_order_id %}"><button type="button" class="btn btn btn-primary">{% trans "返回" %}</button></a>
                <button type="submit" class="btn btn-danger">{% trans "添加" %}</button>
            </div>
        </form>
    </div>
</section>
{% endblock %}